import request from '../utils/Request';
const ps = 1000;
// 订单列表
export async function getOrderList({custId, orderStatus, pn, ps}) {
  return request(
    orderStatus === undefined
      ? `sm/order/list?custId=${custId}&pn=${pn}&ps=${ps}`
      : `sm/order/list?custId=${custId}&orderStatus=${orderStatus}&pn=${pn}&ps=${ps}`,
  );
}
// 取消订单
export async function delOrder({orderId}) {
  return request(`sm/order/update/${orderId}`, {
    method: 'DELETE',
  });
}

// 我的题库
export async function getAswPaperList({pn}) {
  return request(`qm/aswPaper/my/list?pn=${pn}&ps=${ps}&epClazz=01&epScene=01`);
}
// 我的报名

export async function getEnrollList({pn}) {
  return request(`cm/enroll/myList?pn=${pn}&ps=${ps}&obc=createTime&ia=desc`);
}

// 我的报名详情
export async function getEnrollDetail(erId) {
  return request(`cm/enroll/${erId}`);
}

// 我的作业

export async function getMyHworkList({pn}) {
  return request(
    `content/homework/listMyHwork?pn=${pn}&ps=${ps}&obc=createTime&ia=desc`,
  );
}

// 我的消息
export async function getNewList({pn}) {
  return request(`content/news/list?pn=${pn}&ps=${ps}&obc=createTime&ia=desc`);
}
// 我的成绩
export async function getMyScore({pn}) {
  return request(
    `qm/aswPaper/my/list?pn=${pn}&ps=${ps}&obc=createTime&ia=desc`,
  );
}

// 我的课程
export async function courseList(data) {
  return request(
    `content/course/listByCustId?pn=${data.pn}&ps=${data.ps}&custId=${data.custId}&courseClassif=&&obc=createTime&ia=desc`,
  );
}

// 课程详情
export async function courseDetail(courseId) {
  return request(`content/course/${courseId}`);
}

// 课程评论
export async function courseCommonList(courseId) {
  return request(`content/comment/list?artId=${courseId}&pn=1&ps=1000`);
}

// 课程章节
export async function courseCatalogList(courseId) {
  return request(`content/catalog/list?artId=${courseId}`);
}
// 章节详情
export async function fileinfo(fileId) {
  return request(`content/catalog/fileinfo/${fileId}`);
}

// 课程评论
export async function sendComment(data) {
  return request('content/comment', {
    body: data,
    method: 'POST',
  });
}

// 资讯评论
export async function sendNewsComment(data) {
  return request('cm/article/comment', {
    body: data,
    method: 'POST',
  });
}

// 报名列表

export async function enrollList(data) {
  return request(`cm/enroll/list?ps=${data.ps}&pn=${data.pn}`);
}

// cm/enroll 报名提交

export async function enrollAction(data) {
  return request('cm/enroll', {
    body: data,
    method: 'POST',
  });
}
